<template>
  <!-- <div class="cockpit" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-bg.png')})`}"> -->
  <div style="position: relative;z-index: 10">
    <a-row :gutter="40" style="position: relative;z-index: 10;">
      <a-col :span="18">
        <a-row :gutter="24">
          <a-col :span="8">
            <div class="cockpit-card">
              <div class="cockpit-card-title" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-title-bg-1.png')})`}">
                事件摘要
                <!-- <div class="cockpit-card-title-more" @click="toURL('/cockpit/event')">更多 <a-icon type="double-right" /></div> -->
              </div>
              <Card>
                <div class="c-card--title ellipsis">
                  {{ detail.title }}
                </div>
                <div style="margin-top: 8px">
                  <!-- <Tag v-for="(item, i) in tag" :key="i" :color="item.color">{{ item.label }}</Tag> -->
                  <Tag color="default" v-if="detail.typeName">{{ detail.typeName }}</Tag>
                </div>
                <div class="c-card--text ellipsis-3">
                  {{ detail.describe }}
                </div>
                <div class="c-card--detail" @click="getDesDetail({id})">查看详情 <a-icon type="double-right" /></div>
              </Card>
            </div>
          </a-col>
          <a-col :span="11">
            <div class="cockpit-card">
              <div class="cockpit-card-title" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-title-bg-2.png')})`}">
                舆情数据
              </div>
              <Card>
                <div class="c-card--num-bg">
                  <div class="c-card--num" v-if="num.length">
                    <div v-for="(item, i) in num" :key="i">
                      <p>{{ item.value }}</p>
                      <p>{{ item.title }}</p>
                    </div>
                  </div>
                  <div v-else class="c-card--num empty-dark" style="margin-top: 70px">
                    暂无数据
                  </div>
                </div>
                <div class="c-card--rotate">
                  <div :style="{backgroundColor: getTheme().label}"></div>
                </div>
              </Card>
            </div>
          </a-col>
          <a-col :span="5">
            <div class="cockpit-card">
              <div class="cockpit-card-title" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-title-bg-4.png')})`}">
                <span :class="'active'" @click="choose(0)">情感走向</span>
              </div>
              <Card>
                <Pie v-if="reload" :data="pieData" />
              </Card>
            </div>
          </a-col>
        </a-row>
        <a-row :gutter="[0, 20]">
          <a-col :span="24">
            <h1 class="cockpit-title-time">
              图表数据日期: &nbsp;{{ moment(start).format('YYYY年MM月DD日 HH时') }}~{{ moment(end).format('YYYY年MM月DD日 HH时') }}
              <span v-if="progress.endTime" style="margin-left: 12px;font-size: 18px">
                事件结束时间：{{ moment(progress.endTimee).format('MM-DD HH:mm') }}
              </span>
              <span v-else-if="progress.procTime && !getIsFull()" style="margin-left: 12px;font-size: 18px">
                事件处置进行中
              </span>
              <span v-else-if="progress.startTime" style="margin-left: 12px;font-size: 18px">
                创建事件时间：{{ moment(progress.startTime).format('MM-DD HH:mm') }}
              </span>
            </h1>
          </a-col>
          <!-- <a-col :span="2" class="yTime"> -->
          <!-- <div @click="chooseX(item)" :class="xactive == item ? 'xactive' : ''" v-for="item in yTime" :key="item">
              <span v-if="xactive == item">
                <a-icon type="caret-right" />
                <a-icon type="caret-right" />
                <a-icon type="caret-right" />
              </span>
              <div>
                {{ item }} H
              </div>
            </div> -->
          <!-- </a-col> -->
          <a-col :span="24">
            <div class="progress-dark" style="display: none">
              <!-- <p class="doing">事件进行中</p> -->
              <div class="progress-msg" v-if="progress.startTime">
                <div class="progress--time">{{ moment(progress.startTime).format('MM-DD HH:mm') }}</div>
                <div class="progress--circle">

                </div>
                <p>创建事件</p>
              </div>

              <!-- <div class="progress-modal">
                <p>完成核实：{{ moment(progress.procTime).format('YYYY-MM-DD HH:mm') }}</p>
                <p>事件分类：{{ progress.name }}</p>
                <p>事件发展：{{ progress.endTime ? '结束' : '起步' }}</p>
              </div> -->

              <div class="reds progress-msg" :style="{left}" v-if="progress.procTime && !getIsFull()">
                <div class="progress--time">
                  &nbsp;
                  {{ moment(progress.procTime).format('MM-DD HH:mm') }}
                </div>
                <div class="progress--circle">

                </div>
                <p>事件进行中</p>
              </div>

              <div class="reds progress-msg" v-if="progress.endTime">
                <div class="progress--time">{{ moment(progress.endTimee).format('MM-DD HH:mm') }}</div>
                <div class="progress--circle">

                </div>
                <p>事件结束</p>
              </div>
            </div>
            <div style="height: 640px;margin-top: 0;position: relative;">
              <LineCharts ref="lineCharts" />
              <div class="CardModal">
                <div>
                  <CardModal
                    :type="item.isReply == 0 ? 'yellow' : ''"
                    class="CardModal-item"
                    v-for="(item) in Enclosure.filter((e, i) => i<12)"
                    @click.native="queryMbCockpitVo(item)"
                    :key="item.id"
                    :replyTime="item.replyTime"
                    :depart="item.depart"
                    :isReply="item.isReply" />
                </div>
              </div>
              <div class="dark-tag-footer">
                <div class="rang-time">
                  <div @click="nextTime(1)">
                    <a-icon type="left"></a-icon>
                  </div>
                  <div class="rang-time-select">
                    {{ moment(start).format('YYYY年MM月DD日 HH时') }}~{{ moment(end).format('YYYY年MM月DD日 HH时') }}
                    <div>
                      <a-range-picker
                        style="width: 320px"
                        size="small"
                        show-time
                        :allowClear="false"
                        v-model="rangTime2"
                        format="YYYY-MM-DD HH"
                        valueFormat="YYYY-MM-DD HH"
                        :placeholder="['', '']"
                        dropdownClassName="rank-calendar"
                        @change="(s, t) => onChange2(s, t)"
                      >
                      </a-range-picker></div>
                  </div>
                  <div @click="nextTime(2)">
                    <a-icon type="right"></a-icon>
                  </div>
                </div>
                <!-- <div @click="toURL('/cockpit/judge')">
                  <div class="tag-circle">研</div>
                  研判记录
                </div>
                <div @click="toURL('/cockpit/report')">
                  <div class="tag-circle green">报</div>
                  第三方报告
                </div> -->
                <div @click="toURL('/cockpit/hot')">
                  <div class="tag-circle red">热</div>
                  热点事件
                </div>
              </div>
            </div>
          </a-col>
        </a-row>
      </a-col>
      <a-col :span="6">
        <a-row :gutter="[0, 20]">
          <a-col :span="24">
            <div class="cockpit-card">
              <!-- <div class="cockpit-card-title" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-title-bg-2.png')})`}">
                <span :class="[active == 0 ? 'active' : '']" @click="choose(0)">情感走向</span>
                <span :class="[active == 1 ? 'active' : '']" @click="choose(1)">事件热词</span>
              </div>
              <Card style="height: 220px">
                <WordSlide :id="id" v-if="reload && active == 1" :data="wordCloud" />
                <Pie v-if="reload && active == 0" :data="pieData" />
              </Card> -->
              <div class="cockpit-card-title" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-title-bg-2.png')})`}">
                <span :class="[active == 0 ? 'active' : '']" @click="choose(0)">热帖排名</span>
                <span :class="[active == 1 ? 'active' : '']" style="margin-left: -16px" @click="choose(1)">历史排名</span>
                <a-range-picker
                  v-if="active == 1"
                  class="rank-time"
                  size="small"
                  :allowClear="false"
                  style="width: 170px"
                  v-model="rangTime"
                  format="MM-DD"
                  valueFormat="YYYY-MM-DD"
                  :placeholder="['', '']"
                  dropdownClassName="rank-calendar"
                  @change="(s, t) => onChange(s, t, item)"
                >
                  <a-icon slot="suffixIcon" type="calendar" />
                </a-range-picker>
              </div>
              <div class="serach-typelist" v-if="active == 0">
                <div v-for="(item, i) in typeList" :key="i" :class="[hotsParams.source == item.actualValue ? 'activeType' : '']" @click="getHotsList(item.actualValue)">{{ item.actualValue }}</div>
              </div>
              <Card style="height: 400px">
                <div class="scroll scroll-hots" style="margin-top: 4px" v-if="active == 0">
                  <template v-if="hotsList.length">
                    <div class="hot-each" v-for="item in hotsList" :key="item.id">
                      <div :class="['h-list--order', `h-list--order-${item.order}`]">
                        <div class="h-list--order-text">{{ item.order }}</div>
                      </div>
                      <div class="hot-each--content hot1">
                        <h1 @click="toLinkIframe(item)">
                          {{ item.title }}
                          <p>
                            <img width="12px" :src="require('@/assets/Image/icon/hot.png')" alt="" />
                            热度{{ item.hotNumber }}
                          </p>
                        </h1>

                      </div>
                    </div>
                  </template>
                  <div v-else class="c-card--num empty-dark">
                    暂无数据
                  </div>
                </div>
                <div class="scroll-hots" style="margin-top: 4px" v-else-if="active == 1">
                  <template v-if="rankList.length">
                    <div class="rank-each" v-for="item in rankList" :key="item.id">
                      <div class="rank-icon">
                        <img :src="item.icon" width="100%" alt="">
                      </div>
                      <div class="rank-typename">
                        <div>
                          {{ item.source }}
                        </div>
                      </div>
                      <div class="rank-message" @click="toLinkIframe(item)">
                        <h1 class="ellipsis" >{{ item.title }}</h1>
                        <div class="rank-text">
                          <div class="rank-tag">平台排名:</div>
                          <div class="rank-order">
                            <img width="16px" v-if="item.ranking <= 2" :src="require(`@/assets/Image/rank-${item.ranking}.png`)" alt="">
                            <span v-else>{{ item.ranking }}</span>
                          </div>
                          <div class="rank-hot">
                            <img width="16px" :src="require('@/assets/Image/icon/hot.png')" alt="" />
                            <span>{{ item.hotNumber }}</span>
                          </div>
                        </div>

                      </div>
                    </div>
                  </template>
                  <div v-else class="c-card--num empty-dark">
                    暂无数据
                  </div>
                </div>
              </Card>
            </div>
          </a-col>
          <!-- <a-col :span="24">
            <div class="cockpit-card">
              <div class="cockpit-card-title" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-title-bg-2.png')})`}">
                实时热榜
                <div class="cockpit-card-title-more" @click="toURL('/cockpit/hot')">更多 <a-icon type="double-right" /></div>
              </div>
              <Card style="height: 240px">
                <template v-if="hotList.length">
                  <div class="hot-each" v-for="item in hotList" :key="item.id">
                    <div :class="['h-list--order', `h-list--order-${item.order}`]">
                      <div class="h-list--order-text">{{ item.order }}</div>
                    </div>
                    <div class="hot-each--content">
                      <h1 class="ellipsis" @click="toLinkIframe(item)">
                        {{ item.title }}
                        <p>{{ item.createTime }}|{{ item.source }}|阅读量{{ item.readNum }}</p>
                      </h1>

                    </div>
                  </div>
                </template>
                <div v-else class="c-card--num empty-dark">
                  暂无数据
                </div>
              </Card>
            </div>
          </a-col> -->
          <a-col :span="24">
            <div class="cockpit-card">
              <div class="cockpit-card-title" :style="{backgroundImage: `url(${require('@/assets/Image/cockpit-title-bg-2.png')})`}">
                <span :class="[active2 == 0 ? 'active' : '']" @click="choose2(0)">重点文章</span>
                <span :class="[active2 == 1 ? 'active' : '']" @click="choose2(1)">重点账号</span>
              </div>
              <Card style="height: 350px">
                <div v-if="active2 == 1">
                  <template v-if="importantData.length">
                    <h-list
                      type="important"
                      theme="dark"
                      :hideToolTip="true"
                      :data="importantData"
                      :pagination="false"
                      @detail="toLinkIframe2"
                    ></h-list>
                  </template>
                  <div v-else class="c-card--num empty-dark">
                    暂无数据
                  </div>
                </div>
                <div v-if="active2 == 0">
                  <template v-if="articleData.length">
                    <h-list
                      type="article"
                      theme="dark"
                      :hideToolTip="true"
                      :data="articleData"
                      :pagination="false"
                      @detail="toLinkIframe2"
                    ></h-list>
                  </template>
                  <div v-else class="c-card--num empty-dark">
                    暂无数据
                  </div>
                </div>
              </Card>
            </div>
          </a-col>
        </a-row>
      </a-col>
    </a-row>
    <h-modal-dark class="modal-dark modal-dark--askContent" v-model="showE" >
      <h1>指令详情</h1>
      <div class="E">
        <div class="E-dept">
          {{ E.depart }}
        </div>
        <div class="E-content">
          <div class="E-content--each">
            <h1>指令内容：<span>指令下发时间：{{ E.createTime || '无' }}</span></h1>
            <p>{{ E.askContent }}</p>
            <!-- <span class="time-right"></span> -->
          </div>
          <div class="E-content--each">
            <h1>回复内容： <span><span>签收时间：{{ E.signForTime || '无' }}</span>；<span>回复时间：{{ E.replyTime || '无' }}</span></span></h1>
            <p>{{ E.replyContent }}</p>
          </div>
          <!-- <div class="E-content--each E-content--each--bottom">
            <h1><span></span><span>签收时间：{{ E.signForTime }}</span></h1>
          </div> -->
        </div>
        <!-- <p><span>指令内容：</span><span>{{ E.askContent }}</span></p>
        <p>
          <span>回复内容：</span>
          <span v-if="E.replyContent">{{ E.replyContent }}</span>
          <span class="not-reply" v-else>未回复</span>
        </p>
        <p><span>回复时间：</span><span>{{ E.replyTime }}</span></p>
        <p><span>签收时间：</span><span>{{ E.signForTime }}</span></p> -->
      </div>
    </h-modal-dark>
  </div>
</template>
<script>
import moment from 'moment';
import Card from './modules/Card';
import Tag from './modules/Tag';
import WordSlide from './modules/WordSlide';
import Pie from './modules/Charts/Pie/Index';
import LineCharts from './modules/Charts/LineCharts/Index';
import CardModal from './modules/CardModal';
// eslint-disable-next-line no-unused-vars
import { getCockpitStressNumberEvent, getHotWorldEvent, selectDictionaries, selectCockpitSet, impArticle, getEmotionalColorEvent, queryMbCockpitVo, queryPublicOpinionData, getEventCoopertion, queryEnclosure, getHotSearchEvent, getHistoricalRanking, getStressArticleEventt } from '@/api/serve';

export default {
  components: { Card, Tag, WordSlide, Pie, LineCharts, CardModal },
  inject: ['getNumberdetails', 'getDetail', 'getTheme', 'getDesDetail', 'toLink', 'getDate', 'showIframeModal', 'getIsFull'],
  data() {
    return {
      moment,
      show: false,
      showE: false,
      E: {},
      reload: false,
      nowDateNum: -3,
      start: moment().add(-3, 'days').format('YYYY-MM-DD') + ' 00:00:00',
      end: moment().format('YYYY-MM-DD') + ' 00:00:00',
      modalForm: {},
      wordCloud: [],
      pieData: [],
      typeList: [],
      active: 0,
      active2: 0,
      yTime: [
        12, 24, 36, 48, 60, 72
      ],
      Enclosure: [],
      enclosure: [

      ],
      tag: [
        {
          color: 'danger',
          label: '防汛'
        },
        {
          color: 'warning',
          label: '自然灾害'
        },
        {
          color: 'default',
          label: '交通'
        }
      ],
      num: [

      ],
      hotList: [

      ],
      importantData: [],
      id: '',
      title: '',
      detail: {},
      xactive: 72,
      progress: {},
      left: '',
      controllableDegree: {
        0: '可控',
        1: '失控'
      },
      hotsList: [],
      hotsMoreloading: false,
      hotsMorefinished: false,
      hotsParams: {
        pageNo: 1,
        pageSize: 10,
        source: '抖音'
      },
      defaultsource: '',
      articleData: [],
      rankList: [],
      rangTime: [moment().startOf('month').format('YYYY-MM-DD'), moment().format('YYYY-MM-DD')],
      rangTimeForm: {
        startTime: moment().startOf('month').format('YYYY-MM-DD'),
        endTime: moment().format('YYYY-MM-DD')
      },
      rangTime2: []
    };
  },
  beforeDestroy() {

  },
  created() {
    this.id = this.$route.query.id;
    this.title = this.$route.query.title;
    this.getImpAccount();
    this.getImpArticle();
    this.getEmotionalColorEvent();

    this.detail = this.getDetail();
    this.queryPublicOpinionData();
    this.getHotSearchEvent();
    this.getEventCoopertion();
    this.queryEnclosure();

    this.getType();
  },
  computed: {

  },
  mounted() {
    this.$nextTick(() => {
      this.chooseX(72);
      this.$nextTick(() => {
        if (document.querySelector('.scroll-hots')) {
            const selectWrap = document.querySelector('.scroll-hots');
            selectWrap.addEventListener('scroll', this.hotsMore);
        }
      });
    });
  },
  methods: {
    // 重点账号
    getImpAccount(page) {
      getCockpitStressNumberEvent({
        pageNo: page || 1,
        pageSize: 6,
        eventId: this.id
      }).then(res => {
        this.importantData = res.data.records.map((e, i) => {
          return {
            ...e,
            account: e.name,
            order: i + (((page || 1) - 1) * 4) + 1,
            tag: e.label,
            createTime: e.reaseTime ? moment(e.reaseTime).format('MM-DD HH:mm') : ''
          };
        });
        // this.importantDataPage.total = res.data.total;
      });
    },

    // 重点文章
    getImpArticle(page) {
      this.articleLoading = true;
      getStressArticleEventt({
        eventId: this.id,
        pageNo: page || 1,
        pageSize: 6,
        isDelete: 0
      }).then(res => {
        this.articleData = res.data.records;
        // this.articlePage.total = res.data.total;
      }).finally(() => {
        this.articleLoading = false;
      });
    },

    getHotWorldEvent() {
      this.reload = false;
      getHotWorldEvent({ eventId: this.id }).then(res => {
        this.wordCloud = res.data.records.map(e => {
          return {
            name: e.hotWorld,
            value: Number(e.num)
          };
        });
        this.reload = true;
      });
    },
    getEmotionalColorEvent() {
      this.reload = false;
      getEmotionalColorEvent({ eventId: this.id }).then(res => {
        this.reload = true;
        if (!res.data) {
          this.pieData = [];
          return;
        }
        // if (!res.data) {
        //   this.pieData = [];
        //   return;
        // }
        const { positivebfb, neutralbfb, negativebfb } = res.data || {};

        const data = [
          {
            name: '正向',
            value: positivebfb ? Number(positivebfb.replace(/%/, '')) : 0
          },
          {
            name: '中性',
            value: neutralbfb ? Number(neutralbfb.replace(/%/, '')) : 0
          },
          {
            name: '负向',
            value: negativebfb ? Number(negativebfb.replace(/%/, '')) : 0
          }
        ];
        // const sum = data.reduce((acc, cur) => {
        //   return acc + cur.value;
        // }, 0);
        this.pieData = data.map(e => {
          return {
            ...e,
            percent: e.value
          };
        });
      });
    },
    choose(active) {
      this.active = active;
      this.hotsList = [];
      if (active == 1) this.getHistoricalRanking(true);
      if (active == 0) this.getHotsList(true);
    },
    choose2(active) {
      this.active2 = active;
      if (active == 0) this.getImpArticle();
      if (active == 1) this.getImpAccount();
    },
    toURL(path) {
      this.$router.push({ path, query: { id: this.id, title: this.title } });
    },
    queryPublicOpinionData({ startTime, endTime } = {}) {
      queryPublicOpinionData({
        id: this.id,
        startTime: startTime || this.start,
        endTime: endTime || this.end
      }).then(res => {
        this.num = res.data.map(e => {
          return {
            title: e.source,
            value: e.number
          };
        });
      });
    },
    getHotSearchEvent() {
      getHotSearchEvent({
        eventId: this.id,
        pageNo: 1,
        pageSize: 4
      }).then(res => {
        this.hotList = res.data.records.map((e, i) => {
          return {
            ...e,
            order: i + 1
          };
        });
      });
    },
    chooseX(item) {
      this.xactive = item;
      this.$refs.lineCharts.refresh({ eventId: this.id, h: item, start: this.start, end: this.end });
    },
    queryEnclosure() {
      queryEnclosure({
        id: this.id
      }).then(res => {
        this.Enclosure = res.data.map(e => {
          return {
            ...e,
            replyTime: e.replyTime ? moment(e.replyTime).format('HH:mm') : ''
          };
        });
      });
    },
    getEventCoopertion() {
      getEventCoopertion({
        id: this.id
      }).then(res => {
        const data = res.data;
        if (data.procTime) {
          if (data.endTime) {
            const start = new Date(data.startTime).getTime();
            const doing = new Date(data.procTime).getTime();
            const end = new Date(data.endTime).getTime();
            console.log(start);
            const left = (doing - start) / (end - start);
            this.left = ((left <= 0.2 ? 0.2 : (left > 0.8 ? 0.8 : left)) * 100) + '%';
          } else {
            this.left = 'auto';
          }
        }

        this.progress = data;
      }).catch(() => {

        // if (data.procTime) {
        //   if (data.endTime) {
        //     const start = new Date(data.startTime).getTime();
        //     const doing = new Date(data.procTime).getTime();
        //     const end = new Date(data.endTime).getTime();
        //     this.left = (doing - start) / (end - start) * 100 + '%';
        //   } else {
        //     this.left = 'auto';
        //   }
        // }
        // this.progress = data;
      });
    },
    nextTime(type) {
      if (type == 1) {
        this.nowDateNum -= 3;
        this.start = moment().add(this.nowDateNum, 'days').format('YYYY-MM-DD') + ' 00:00:00';
        this.end = moment().add(this.nowDateNum + 3, 'days').format('YYYY-MM-DD') + ' 00:00:00';
      } else {
        this.nowDateNum += 3;
        this.start = moment().add(this.nowDateNum, 'days').format('YYYY-MM-DD') + ' 00:00:00';
        this.end = moment().add(this.nowDateNum + 3, 'days').format('YYYY-MM-DD') + ' 00:00:00';
      }
      this.$refs.lineCharts.refresh({ eventId: this.id, h: this.xactive, start: this.start, end: this.end });
      this.queryPublicOpinionData({ startTime: this.start, endTime: this.end });
    },
    onChange2(s, time) {
      console.log(time);
      this.start = time[0] + ':00:00';
      this.end = time[1] + ':00:00';
      this.$refs.lineCharts.refresh({ eventId: this.id, h: this.xactive, start: this.start, end: this.end });
      this.queryPublicOpinionData({ startTime: this.start, endTime: this.end });
    },
    toLinkIframe({ link, title, createTime }) {
      this.showIframeModal(link, { title, createTime });
    },
    toLinkIframe2({ link, title, reaseTime }) {
      this.showIframeModal(link, { title, createTime: reaseTime });
    },
    queryMbCockpitVo({ id }) {
      this.showE = true;
      queryMbCockpitVo({ id }).then(res => {
        this.E = res.data;
      });
    },
    getHotsList(source) {
      this.hotsMoreloading = true;
      const hotsParams = this.hotsParams;
      if (this.active == 1) {
        delete hotsParams.source;
        if (source === true) {
          hotsParams.pageNo = 1;
          this.hotsList = [];
          this.hotsMorefinished = false;
        }
      } else if (source) {
        this.hotsList = [];
        this.hotsMorefinished = false;
        if (source !== true) {
          hotsParams.source = source;
        } else {
          hotsParams.source = this.defaultsource;
        }
        hotsParams.pageNo = 1;
      }
      getHotSearchEvent({
        eventId: this.id,
        ...hotsParams
      }).then(res => {
        const hotsList = res.data.records;

        this.hotsList = this.hotsList.concat(hotsList).map((e, i) => {
          return {
            ...e,
            source: `数据来源：${e.source}`,
            createTime: `获取时间：${moment(e.createTime).format('MM/DD HH:mm')}`,
            order: i + 1,
            title: e.title.substring(0, 40) + (e.title.length > 40 ? '...' : '')
          };
        });
      }).finally(() => {
        this.hotsMoreloading = false;
      });
    },
    hotsMore() {
      if (this.hotsMoreloading || this.hotsMorefinished) return;
      const scrollWrap = document.querySelector('.scroll-hots');
      var currentScrollTop = scrollWrap.scrollTop;
      var currentOffsetHeight = scrollWrap.scrollHeight;
      var currentClientHeight = scrollWrap.clientHeight;
      if ((currentScrollTop + currentClientHeight >= currentOffsetHeight - 80)) {
        // 到底部了 重新请求数据
        this.hotsParams.pageNo++; // 页码++
        this.getHotsList();
      }
    },
    getType() {
      // selectCockpitSet({
      //   eventId: this.id
      // }).then(res => {
      //   this.typeList = res.data;
      //   this.defaultsource = res.data && res.data[0].actualValue;
      //   this.hotsParams.source = this.defaultsource;
      //   this.getHotsList();
      // });
      selectDictionaries({
        eventId: this.id
      }).then(res => {
        this.typeList = res.data;
        // this.hotsParams.source = res.data && res.data[0].actualValue;

        selectCockpitSet({
          eventId: this.id
        }).then(res => {
          // const ids = res.data.map(e => e.dictionaryId);
          // this.typeList = typeList.filter(e => ids.includes(e.id));
          const id = res.data.map(e => e.dictionaryId)[0];
          const dataFind = this.typeList.find(e => e.id == id);
          if (dataFind) {
            this.defaultsource = dataFind.actualValue;
          } else {
            this.defaultsource = (this.typeList && this.typeList[0] && this.typeList[0].actualValue) || '';
          }

          this.hotsParams.source = this.defaultsource;
          this.getHotsList();
        });
        // const name = this.typeList.find(e => e.name == this.eventDetailInfo.typeName);
        // if (name) {
        //   this.typeForm.typeId = name.id;
        // }
      });
    },
    getHistoricalRanking() {
      this.rangTimeForm.eventId = this.id;
      getHistoricalRanking(this.rangTimeForm).then(res => {
        this.rankList = res.data;
      }).catch(res => {
        this.rankList = res.data;
      });
    },
    onChange(s, t) {
      this.rangTimeForm.startTime = moment(s[0]).format('YYYY-MM-DD');
      this.rangTimeForm.endTime = moment(s[1]).format('YYYY-MM-DD');
      this.getHistoricalRanking();
    }
  }
};
</script>
<style lang="less" scoped>

  .cockpit {
    background-size: 100% 100%;
    background-position: top center;
    height: 1080px;
    position: relative;
    overflow: hidden;
    // background-color: rgb(4,11,36);
    .scroll{
      height: 380px;
      overflow-y: auto;
      width: 105%;
      padding-right: 5%;
    }
    .hot-each {
      display: flex;
      align-items: center;
      margin-bottom: 6px;
      position: relative;
      &:nth-child(5) {
        margin-top: 8px;
      }

      // &::before {
      //   content: ' ';
      //   position: absolute;
      //   width: 14px;
      //   height: 14px;
      //   border: 1px solid #5CA1F2;
      //   border-radius: 100%;
      //   left: 30px;
      // }
      // &::after {
      //   content: ' ';
      //   position: absolute;
      //   width: 1px;
      //   height: 43px;
      //   background: #395a81;
      //   left: 37px;
      //   top: 29px;
      // }
      // &:last-child {
      //   &::after {
      //     display: none;
      //   }
      // }

      .h-list--order-text {
        color: #fff;
        font-size: 15px;
        width: 20px;
        height: 20px;
        border-radius: 100%;
        background: #36414F;
        line-height: 20px;
        text-align: center;
        // font-weight: bold;
      }
      .h-list--order-1 {
        .h-list--order-text {
          background: #E19F29;
        }

      }
      .h-list--order-2 {
        .h-list--order-text {
          background: #85939F;
        }
      }
      .h-list--order-3 {
        .h-list--order-text {
          background: #B46949;
        }
      }
      .h-list--order-4 {
        .h-list--order-text {
          background: #36414F;
        }
      }
      .title {
        // height: 23px;
      }
      .h-list--order {
        height: 20px;
      }

      .hot-each--content {
        margin-left: 38px;
        width: 84%;
        h1 {
          width: 100%;
          font-size: 12px;
          font-weight: 400;
          color: #FFFFFF;
          line-height: 24px;
          margin: 0;
          cursor: pointer;
          transition: all 0.3s;
          &:hover {
            color: #48AAFB;
          }
        }
        &.hot1 {
          margin-left: 14px;
          width: 94%;
          h1 {
            font-size: 12px;
            height: 50px;
            position: relative;
            line-height: 2;
            // margin-top: 5px;
          }
          p {
            position: absolute;
            right: 0;
            bottom: 2px;
            // line-height: 2;
            color: red;
            img {
              margin-right: 2px;
              margin-top: -3px;
            }
          }
        }
        p {
          font-size: 12px;
          font-weight: 400;
          color: #CBCBCB;
          line-height: 24px;
          margin: 0;
        }
      }
    }

    .yTime {
      font-size: 24px;
      font-weight: 500;
      color: #888888;
      margin-top: 35px;

      >div {
        margin-bottom: 60px;
        margin-left: 40px;
        cursor: pointer;
        &.xactive {
          color: #fff;
          font-weight: bold;
          >span {
            i {
              margin-right: -5px;
              color: #1E6CBA;
              font-size: 22px;
            }
          }
        }
      }
    }

    .progress-dark {
      width: 74%;
      height: 4px;
      background: #1c2f68;
      margin-left: 60px;
      margin-top: 50px;
      position: relative;
      .doing {
        color: #fff;
        position: absolute;
        left: 50%;
        top: 12px;
        opacity: 0.6;
        transform: translate(-50%, 0);
      }
      .progress-modal {
        width: 207px;
        height: 106px;
        border: 2px solid #0D4088;
        box-shadow: 0px 0px 8px 1px #163B7A, 0px 0px 33px 2px rgba(22,59,122,0.18);
        position: absolute;
        right: -277px;
        top: -50px;
        padding-top: 4px;
        >p {
          color: #fff;
          margin: 8px 0;
          margin-left: 14px;
          font-size: 13px;
        }
      }
      >.progress-msg {
        position: absolute;
        left: 0;
        top: 13px;
        transform: translate(0, -50%);
        width: 88px;
        &:last-child:not(:first-child) {
          right: 0;
          left: auto;
          text-align: right;
          transform: translate(50%, -50%);
          >p {
            transform: translate(0, 0);
          }
          .progress--time {
            transform: translate(0, 0);
            white-space: nowrap;
          }
          .progress--circle {
            transform: translate(100%, 0);
          }
        }
        .progress--time {
          color: #fff;
          margin-bottom: 8px;
          transform: translate(-29%, 0);
          white-space: nowrap;
        }
        .progress--circle {
          width: 26px;
          height: 26px;
          background: #115FC1;
          border: 2px solid #0D4088;
          border-radius: 100%;
        }
        >p {
          font-size: 15px;
          font-weight: 500;
          color: #4490EE;
          text-align: center;
          transform: translate(-30%, 0);
          margin-top: 13px;
        }
        &.yellow {
          .progress--circle {
            background: #E0B90C;
            border: 2px solid #917C2B;
          }
          >p {
            color: #BC7B1F;
          }
        }
        &.reds {
          .progress--circle {
            background: #FC0001;
            border: 2px solid #8F1520;
          }
          >p {
            color: #AB302D;
          }
        }
      }
    }

    .CardModal {
      position: absolute;
      top: 46%;
      left: 60px;
      height: 260px;
      width: 90%;
      >div {
        display: flex;
        flex-wrap: wrap;
        >div {
          margin-bottom: 20px;
        }
      }
      .CardModal-item {
        margin-right: 12px;
        cursor: pointer;
      }
    }
    .c-card--num-bg {
      position: relative;
      z-index: 222;
    }
    .c-card--rotate {
      width: 88%;
      height: 60px;
      perspective: 300px;
      position: absolute;
      bottom: 30px;
      left: 50%;
      transform: translate(-50%, 0);
      >div {
        height: 60px;
        background: #081431;
        border: 2px solid #2C4979;
        transform-style: preserve-3d;
        transform: rotateX(40deg);
        perspective: 200px;
      }
    }

    .dark-tag-footer {
      display: flex;
      position: absolute;
      bottom: 0;
      width: 540px;
      // left: -100px;
      left: 0;
      >div {
        color: #fff;
        margin-right: 40px;
        cursor: pointer;
        .tag-circle {
          width: 29px;
          height: 29px;
          background: #126C95;
          border: 2px solid #FFFFFF;
          border-radius: 100%;
          font-size: 13px;
          text-align: center;
          line-height: 25px;
          box-sizing: border-box;
          font-weight: 400;
          color: #FFFFFF;
          margin-right: 12px;
          display: inline-block;
          &.green {
            background: #127845;
          }
          &.red {
            background: #860805;
          }
        }
      }
    }

  }

  .cockpit-title-time{
    font-size: 20px;
    font-family: Source Han Sans CN;
    font-weight: 500;
    font-style: italic;
    color: #FFFFFF;
    margin: 0;
    margin-top: 10px;
    margin-bottom: -20px;
    letter-spacing: 1px;
    margin-left: 10px;
  }

  .rang-time {
    display: flex;
    align-items: center;
    margin-right: 8px !important;
    >div:first-child,>div:last-child {
      width: 20px;
      height: 20px;
      border: 1px solid #FFFFFF;
      border-radius: 100%;
      font-size: 12px;
      line-height: 18px;
      text-align: center;
      i {
        transform: scale(0.8);
      }
    }
    .rang-time-select {
      width: 320px;
      height: 31px;
      background: #13345C;
      border: 1px solid #FFFFFF;
      border-radius: 15px;
      font-size: 14px;
      font-weight: 500;
      color: #FFFFFF;
      text-align: center;
      line-height: 28px;
      margin: 0 6px;
      position: relative;
      >div {
        position: absolute;
        left: 0;
        top: 0;
        width: 100px !important;
        opacity: 0;
      }
    }
  }

  .E {
    width: 80%;
    margin: 0 auto;
    margin-top: 60px;
    .E-dept {
      width: 209px;
      height: 40px;
      background: linear-gradient(to right, rgba(0, 43, 83, 1) , rgba(0, 43, 83, 0));
      // border: 1px solid #29FFFF;
      border-top: 1px solid;
      border-image: linear-gradient(to right, rgba(41, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%) 8 8 8 8;
      border-bottom: 1px solid;
      border-image: linear-gradient(to right, rgba(41, 255, 255, 1) 0%, rgba(255, 255, 255, 0) 100%) 8 8 8 8;
      border-left: 1px solid #29FFFF;
      // border-top: 1px solid linear-gradient(to right, rgb(41, 255, 255) , rgba(41, 255, 255, 0));
      font-size: 24px;
      font-weight: bold;
      color: #27CEF8;
      line-height: 34px;
      // text-align: center;
      text-indent: 28px;
    }
    .E-content {
      .E-content--each {
        width: 100%;
        min-height: 95px;
        background: #20314B;
        border: 2px solid #83AFE7;
        margin-top: 32px;
        text-align: left;
        padding: 0 22px;
        box-sizing: border-box;
        position: relative;
        .time-right {
          position: absolute;
          right: 24px;
          bottom: 12px;
          color: #27CEF8;
          font-size: 14px;
        }
        &.E-content--each--bottom {
          min-height: auto;
          border: none;
          background: none;
          margin-top: 12px;
        }
        h1 {
          text-align: left;
          font-size: 20px;
          font-weight: 400;
          color: #27CEF8;
          line-height: 38px;
          margin: 0;
          margin-top: 6px;
          display: flex;
          justify-content: space-between;
          span {
            font-size: 14px;
            // letter-spacing: 2px;
          }
        }
        p {
          text-align: left;
          font-size: 18px;
          font-weight: 400;
          color: #FFFFFF;
          line-height: 38px;
          margin: 0;
          padding: 0;
          width: 70%;
        }
      }
    }
    p {
      color: #fff;
      text-align: left;
      display: flex;
      justify-content: space-between;
      font-size: 15px;
      border-bottom: 1px solid rgba(255,255,255,0.1);
      padding: 0 40px;
      padding-bottom: 20px;
      span:first-child {
        flex-shrink: 0;
        margin-right: 40px;
      }
      span.not-reply {
        opacity: 0.5;
      }
    }
  }

  .serach-typelist {
    display: flex;
    margin-top: 8px;
    >div {
      min-width: 36px;
      height: 22px;
      border: 1px solid #1961C3;
      border-radius: 1px;
      font-size: 11px;
      font-weight: 400;
      color: #FFFFFF;
      opacity: 0.6;
      text-align: center;
      line-height: 20px;
      cursor: pointer;
      &.activeType {
        border: 1px solid rgba(0,0,0,0);
        background: linear-gradient(0deg, #0777FD 0%, #1C5AA4 56.00000000000001%, #165196 100%);
        // opacity: 0.6;
        border-radius: 1px;
        opacity: 1;
      }
    }
  }
  .cockpit-bd-card {
    padding: 6px 12px;
  }
  .rank-each {
    display: flex;
    padding: 12px 0;
    overflow: hidden;
    cursor: pointer;
    &:not(:last-child) {
      border-bottom: 1px solid rgba(79, 79, 79, 0.5);
    }
    &:hover {
      .rank-message h1 {
        color: #48AAFB;
      }
    }
    .rank-icon {
      width: 46px;
      flex-shrink: 0;
      height: 46px;
      overflow: hidden;
    }
    .rank-typename {
      width: 24px;
      // height: 46px;
      padding: 2px 0;
      flex-shrink: 0;
      border: 1px solid #FFFFFF;
      border-radius: 2px;
      font-size: 14px;
      font-weight: 400;
      color: #FFFFFF;
      line-height: 1.1;
      text-align: center;
      margin-left: 4px;
      flex-shrink: 1;
      >div {
        // transform: scale(0.9);
      }
    }
    .rank-message {
      flex-shrink: 1;
      margin-left: 10px;
      width: calc(100% - 80px);
      overflow: hidden;
      h1 {
        transition: all 0.3s;
        width: 94%;
        font-size: 14px;
        font-weight: 400;
        color: #FFFFFF;
        line-height: 1;
      }
      .rank-tag {
        width: 70px;
        height: 22px;
        background: #132548;
        border: 1px solid #408FEF;
        border-radius: 3px;
        font-size: 12px;
        font-weight: 400;
        color: #FFFFFF;
        line-height: 20px;
        text-align: center;
      }
      .rank-text {
        display: flex;
        align-items: center;
        position: relative;
        margin-top: 12px;
      }
      .rank-order {
        width: 18px;
        min-height: 18px;
        background: #36414F;
        border-radius: 100%;
        font-size: 12px;
        font-weight: 400;
        color: #FFFFFF;
        line-height: 18px;
        text-align: center;
        margin-left: 12px;
      }
      .rank-hot {
        position: absolute;
        right: 20px;
        color: #D81E06;
        font-size: 16px;
        width: 80px;
        text-align: left;
        white-space: nowrap;
        img {
          transform: translate(0, -2px);
          margin-right: 10px;
        }
      }
    }
  }

</style>

<style lang="less">
.rank-time {
  position: absolute;
  right: -80px;
  top: 8px;
  opacity: 1 !important;
  padding-right: 40px;
  padding-left: 0;
  i {
    color: #fff;
  }
  span {
    color: #fff;
  }
  .ant-input {
    background: none;
    border: 1px solid #fff;
    color: #fff;
    padding: 0;
    input {
      width: 38%;
    }
  }
}
.rank-calendar {
  .ant-calendar {
    background: rgba(24,42,84, 0.9);
    border: 2px solid #5fa3f7;
  }
  .ant-calendar-time-picker-btn {
    color: #fff;
  }
  input {
    background: transparent !important;
    color: #fff !important;
  }
  tr,td,.ant-calendar-date,.ant-calendar-header .ant-calendar-century-select, .ant-calendar-header .ant-calendar-decade-select, .ant-calendar-header .ant-calendar-year-select, .ant-calendar-header .ant-calendar-month-select {
    color: #fff !important;
  }
  .ant-calendar-last-month-cell .ant-calendar-date {
    color: #aaa !important;
  }
  .ant-calendar-today .ant-calendar-date {
    border-color: #5fa3f7;
  }
  .ant-calendar-range .ant-calendar-selected-start-date .ant-calendar-date,.ant-calendar-range .ant-calendar-selected-end-date .ant-calendar-date {
    background: #5fa3f7;
  }
  .ant-calendar-range .ant-calendar-in-range-cell::before {
    background: #304966;
  }
  .ant-calendar-input-wrap, .ant-calendar-range .ant-calendar-body, .ant-calendar-range .ant-calendar-month-panel-body, .ant-calendar-range .ant-calendar-year-panel-body, .ant-calendar-range .ant-calendar-decade-panel-body {
    border-color: #5fa3f7;
  }
  .ant-calendar-header .ant-calendar-next-month-btn::before, .ant-calendar-header .ant-calendar-next-month-btn::after,.ant-calendar-header .ant-calendar-next-century-btn::before, .ant-calendar-header .ant-calendar-next-decade-btn::before, .ant-calendar-header .ant-calendar-next-year-btn::before, .ant-calendar-header .ant-calendar-next-century-btn::after, .ant-calendar-header .ant-calendar-next-decade-btn::after, .ant-calendar-header .ant-calendar-next-year-btn::after,.ant-calendar-header .ant-calendar-prev-month-btn::before, .ant-calendar-header .ant-calendar-prev-month-btn::after, .ant-calendar-header .ant-calendar-prev-century-btn::before, .ant-calendar-header .ant-calendar-prev-decade-btn::before, .ant-calendar-header .ant-calendar-prev-year-btn::before, .ant-calendar-header .ant-calendar-prev-century-btn::after, .ant-calendar-header .ant-calendar-prev-decade-btn::after, .ant-calendar-header .ant-calendar-prev-year-btn::after {
    border-color: #fff;
  }
  .ant-calendar-header a:hover {
    color: #5fa3f7;
    // transform: scale(1.2);
  }
}
</style>
